package main;

import java.util.LinkedList;

public class Utilities {
	public static boolean parseMove(String moves, byte player, SympleBoard b) {
		String[] split = moves.split("-");
		LinkedList<Integer> parsed = new LinkedList<Integer>();
		for (String move : split) {
			parsed.add(parseMove(move));
		}
		boolean valid = false;
		if (parsed.size() == 1) {
			valid = valid || b.move(player, parsed.getFirst());
			valid = valid || b.move(player, parsed);
		} else {
			valid = valid || b.move(player, parsed);
		}
		return valid;
	}

	public static int parseMove(String move) {
		char c = move.charAt(0);
		int y = Integer.parseInt(move.substring(1));
		return 15 * (15 - y) + (c - 'A');
	}
}
